<!--
**********************************************************
* @Author: 张小平
* @Date:   2024-05-01
* @Email:  qqshuqian@163.com
* @Last modified: 最后修改日期
* @Description: 文件描述
**********************************************************
-->
<template>
  <div class="btns">
    <div class="btn-area" >

      <div v-show="visible" role="tooltip" id="el-popover-7127" aria-hidden="false" class="el-popover el-popper" style="width: 320px; transform-origin: left center 0px; z-index: 2041; position: absolute; top: 158px; left: 377px;" tabindex="0" x-placement="right">

        <div class="panel">
          <div class="panel-cell" @click="handleAddItem(nodeType.USERTASK)">
            <div class="icon"><i class="el-icon-edit" /></div>
            <div class="text">办理</div>
          </div>
          <div class="panel-cell" @click="handleAddItem(nodeType.CCTASK)">
            <div class="icon cc"><i class="el-icon-document-copy" /></div>
            <div class="text">抄送</div>
          </div>
          <div class="panel-cell"  @click="handleAddItem(nodeType.BRANCHTASK)"
               style="margin-top: 10px;">
            <div class="icon branch"><i class="el-icon-connection" /></div>
            <div class="text">条件分支</div>
          </div>
        </div>
      </div>
      <div><el-button  slot="reference" class="btn"  @click="handleOpen">+</el-button></div>
    </div>

  </div>
</template>

<script>
import { nodeType } from '@/framework-code/utils/constants'
export default {
  data() {
    return {
      isOpen: false,
      nodeType,
      visible: false
    }
  },
  created() {
  },
  methods: {

    handleOpen() {
      debugger
      this.visible = true
    },
    handleAddItem(type) {
      this.visible = false
      this.$emit('on-add-item', type)
    }
  }
}
</script>

<style lang="scss" scoped>

  @mixin layCenter {
    display: flex;
    align-items: center;
    justify-content: center;
  }
  $todo: #fb6036;
  $cc: #3296FA;
  $mainBg: #409eff;
  .btns::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: -1;
    margin: auto;
    width: 2px;
    height: 100%;
    background-color: #CACACA;
  }
  .btns {
    width: 240px;
    @include layCenter;
  }
  .btn-area {
    width: 100%;
    padding: 30px 0px;
    @include layCenter;
  }
  .btn {
    border: 0;
    background-color: $mainBg;
    color: #FFF;
    vertical-align: middle;
    border-radius: 50%;
    height: 30px;
    width: 30px;
    font-size: 20px;
    padding-bottom: 5px;
  }
  .panel {
    display: flex;
    flex-flow: row wrap;
  }
  .panel-cell {
    width: 46.5%;
    box-sizing: border-box;
    border-radius: 5px;
    background-color: #f5f5f5;
    border: 1px solid #f5f5f5;
    display: flex;
    align-items: center;
    padding: 10px;
    margin: 0 5px;
    cursor: pointer;
  }
  .panel-cell:hover {
    border: 1px solid #f5f5f5;
    background-color: #FFF;
    box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.1);
  }
  .icon {
    color: $todo;
    border: 1px solid #cccccc;
    background-color: #FFF;
    padding: 6px 8px;
    border-radius: 10px;
    font-size: 16px;
  }
  .icon.cc {
    color: $cc;
  }
  .icon.branch {
    color: green;
  }
  .text {
    padding-left: 10px;
    color: #000;
  }
  </style>
